<template>
  <div>
    <!-- 表单 -->
    <el-form ref="form" :model="type" label-width="80px">
      <el-form-item label="分类名称">
        <el-input v-model="type.typeName" />
      </el-form-item>
      <el-form-item label="是否启用">
        <el-input v-model="type.enable" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">立即修改</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
// 引入接口API
import typeApi from '@/api/type'
export default {
  props: {
    type: {
      type: Object,
      default: null
    }
  },
  methods: {
    onSubmit() {
      typeApi.update(this.type).then(Response => {
        this.$message.success(Response.msg)
        this.$emit('closeUpdateDialog')
        this.$emit('getTypeList')
      })
    }
  }
}
</script>
<style scoped>
.container{
  margin: 20px 35px;
}
</style>
